﻿@model IEnumerable<SeagullConsulting.MvcAjaxControls.Data.Models.Person>
@using SeagullConsulting.MvcAjaxControls.Web.Mvc.Helpers;

@{
	ViewBag.Title = "ListPage";
}

<h2>AjaxGrid - Paged List</h2>
<p>
	@Html.ActionLink("Add New", "Create", null, new { @class = "actionButton" })
</p>
@(Html.AjaxGridFor<SeagullConsulting.MvcAjaxControls.Data.Models.Person>()
	.WithColumns(column => {
		column.Expression("First Name", p => p.FirstName, ColumnFormats.String, true);
		column.Expression("Last Name", p => p.LastName, ColumnFormats.String, true);
		column.Expression(p => p.Address);
		column.Expression("City", p => p.City.Name);
		column.Expression("Birthday", p => p.Birthday, ColumnFormats.ShortDate);
		column.Expression(p => p.Income, ColumnFormats.Currency);              
	})
	.WithActionColumns(column => {
		column.ImageActionLink("Details", "Details", p => p.Id, @Url.Content("~/Content/Images/Details.png"));
		column.ImageActionLink("Edit", "Edit", p => p.Id, @Url.Content("~/Content/Images/Edit.png"));
		column.ImageActionLink("Delete", "Delete", p => p.Id, @Url.Content("~/Content/Images/Delete.png"));
		column.ImageActionLink("Phones", "ListPage", "Phone", p => p.Id, @Url.Content("~/Content/Images/Button.png"));
	})
	.FromDataSource(@Url.Action("ListPerson"))
	.WithPaging(10)
	.WithFiltering(true, @Url.Action("FilterPerson"))
	.ToHtml()
)
<br />
@Html.ActionLink("AjaxGrid Index", "Index")
<div id="loader" class="loader">
	<img id="img-loader" src="@Url.Content("~/Content/images/Ajax-loader.gif")" alt="Loading"/>
	</div>
<br />
